package com.example.generator.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.generator.entity.TableInfoDO;
import com.example.generator.entity.TableInfoPageDTO;
import com.example.generator.repository.IEasyGeneratorDomainRepository;
import com.example.generator.repository.ITableInfoDomainRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * com.example.generator.service
 *
 * @author smallNorth_Lee
 * @date 2022/1/12
 */
@Service
@AllArgsConstructor
public class TableInfoAppService {

    private final ITableInfoDomainRepository tableInfoDomainService;

    private IEasyGeneratorDomainRepository codeGeneratorService;

    /**
     * 查询所有表
     *
     * @param tableInfoPageDTO 查询参数
     * @return
     */
    public IPage<TableInfoDO> queryTableInfo(TableInfoPageDTO tableInfoPageDTO) {
        return tableInfoDomainService.queryTables(tableInfoPageDTO);
    }

    /**
     * 生成代码
     *
     * @param objectMap 参数
     * @return true/false
     */
    public String createCode(Map<String, Object> objectMap) {
        return codeGeneratorService.generator(objectMap);
    }
}
